This repository was archived by the owner on May 15, 2026. It is now read-only.
feat: add GLM model detection with temperature settings for LM Studio and OpenAI-compatible providers - #11120
Draft
ghost wants to merge 1 commit into
Draft
feat: add GLM model detection with temperature settings for LM Studio and OpenAI-compatible providers#11120ghost wants to merge 1 commit into
ghost wants to merge 1 commit into
Conversation
…OpenAI-compatible providers - Add GLM model detection utility (src/api/providers/utils/glm-model-detection.ts) - Detects GLM family models (4.5, 4.6, 4.7 and variants) - Supports various model ID formats (official, LM Studio, GGUF, mlx-community) - Returns GLM-specific configuration: temperature=0.6, mergeToolResultText, disableParallelToolCalls - Includes diagnostic logging for detection results - Update LM Studio provider (src/api/providers/lm-studio.ts) - Detect GLM models on initialization - Apply temperature=0.6 for GLM models (ZAI_DEFAULT_TEMPERATURE) - Use convertToZAiFormat with mergeToolResultText for GLM models - Disable parallel_tool_calls for GLM models - Update OpenAI-compatible provider (src/api/providers/openai.ts) - Detect GLM models on initialization - Apply temperature=0.6 for GLM models - Use convertToZAiFormat with mergeToolResultText for GLM models - Disable parallel_tool_calls for GLM models - Add comprehensive tests for GLM detection Addresses Issue #11071: GLM models stuck repeating file reads
Author
Review complete. Found 1 issue that should be addressed before merging.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
ghost
commented
Jan 30, 2026
Comment on lines
275
to
282
| const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming = { | ||
| model: modelId, | ||
| messages: deepseekReasoner | ||
| ? convertToR1Format([{ role: "user", content: systemPrompt }, ...messages]) | ||
| : [systemMessage, ...convertToOpenAiMessages(messages)], | ||
| messages: nonStreamingMessages, | ||
| // Tools are always present (minimum ALWAYS_AVAILABLE_TOOLS) | ||
| tools: this.convertToolsForOpenAI(metadata?.tools), | ||
| tool_choice: metadata?.tool_choice, | ||
| parallel_tool_calls: metadata?.parallelToolCalls ?? true, | ||
| parallel_tool_calls: nonStreamingParallelToolCalls, | ||
| } |
Author
There was a problem hiding this comment.
When streaming is disabled, the GLM temperature setting (0.6) is not applied here. The streaming path correctly calculates and applies temperature (lines 168-178), but this non-streaming path is missing it. This will cause inconsistent behavior where GLM models get temperature=0.6 only when streaming is enabled.
Suggested change
| const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming = { | |
| model: modelId, | |
| messages: deepseekReasoner | |
| ? convertToR1Format([{ role: "user", content: systemPrompt }, ...messages]) | |
| : [systemMessage, ...convertToOpenAiMessages(messages)], | |
| messages: nonStreamingMessages, | |
| // Tools are always present (minimum ALWAYS_AVAILABLE_TOOLS) | |
| tools: this.convertToolsForOpenAI(metadata?.tools), | |
| tool_choice: metadata?.tool_choice, | |
| parallel_tool_calls: metadata?.parallelToolCalls ?? true, | |
| parallel_tool_calls: nonStreamingParallelToolCalls, | |
| } | |
| const requestOptions: OpenAI.Chat.Completions.ChatCompletionCreateParamsNonStreaming = { | |
| model: modelId, | |
| temperature: this.options.modelTemperature ?? (this.glmConfig.isGlm ? this.glmConfig.temperature : (deepseekReasoner ? DEEP_SEEK_DEFAULT_TEMPERATURE : 0)), | |
| messages: nonStreamingMessages, | |
| // Tools are always present (minimum ALWAYS_AVAILABLE_TOOLS) | |
| tools: this.convertToolsForOpenAI(metadata?.tools), | |
| tool_choice: metadata?.tool_choice, | |
| parallel_tool_calls: nonStreamingParallelToolCalls, | |
| } |
Fix it with Roo Code or mention @roomote and request a fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR attempts to address Issue #11071 by adding GLM model detection and applying the correct temperature settings when GLM models are detected via LM Studio or OpenAI-compatible endpoints.
What this PR does
GLM Model Detection Utility (
src/api/providers/utils/glm-model-detection.ts)glm-4.5,glm-4.7-flashmlx-community/GLM-4.5-4bitGLM-4.5-UD-Q8_K_XL-00001-of-00008.gguf0.6(ZAI_DEFAULT_TEMPERATURE) - same as Z.ai providertrue- prevents conversation flow disruptiontrue- GLM models may not support this parameterLM Studio Provider (
src/api/providers/lm-studio.ts)convertToZAiFormatwithmergeToolResultTextfor GLM modelsparallel_tool_callsfor GLM modelsOpenAI-compatible Provider (
src/api/providers/openai.ts)convertToZAiFormatwithmergeToolResultTextfor GLM modelsparallel_tool_callsfor GLM modelsAnswers to the user's question
@mark-ucalgary asked: "So if GLM4.7 is detected what temperature etc. will be used? What about if GLM4.5 is detected?"
Answer:
All GLM models (4.5, 4.6, 4.7 and their variants) will use temperature=0.6 when detected via LM Studio or OpenAI-compatible endpoints. This matches the Z.ai provider's default temperature (
ZAI_DEFAULT_TEMPERATURE).Testing
Added comprehensive test suite covering:
Related Issues
Addresses Issue #11071
Feedback and guidance are welcome!
Important
Adds GLM model detection and configuration for LM Studio and OpenAI-compatible providers, applying specific settings for detected GLM models.
detectGlmModel()inglm-model-detection.tsto identify GLM models (4.5, 4.6, 4.7) and variants.LmStudioHandlerandOpenAiHandlerinlm-studio.tsandopenai.tsdetect GLM models on initialization.convertToZAiFormat, and disableparallel_tool_callsfor GLM models.glm-model-detection.spec.tsto test GLM detection for various formats and settings application.This description was created by
for 34d4383. You can customize this summary. It will automatically update as commits are pushed.